<template>
  <div class="unitBar">
    <div class="componentTitle">组件显示</div>
    <div class="componentInfo">
      <span>进入次数：</span><span>{{inAcount}}</span>&nbsp;&nbsp;
      <span>退出次数：</span><span>{{outAcount}}</span>&nbsp;&nbsp;
      <input type="text" v-model="strNum">
    </div>
  </div>
</template>

<script>
export default{
   name:'TextAlbum'
}
</script>
<script setup>
import { onActivated, onDeactivated,ref } from "vue";

let inAcount=ref(0);
let outAcount=ref(0);
let strNum=ref('春风吹10里');
onActivated(()=>{
  inAcount.value++;
})
onDeactivated(()=>{
  outAcount.value++;
}) 
</script>

<style scoped>
.unitBar{
    width: 400px;
    border: 2px solid #0076ee;
}
.componentTitle{
  width: 100%;
  height: 30px;
  background-color:  #0076ee;
  line-height: 30px;
  text-align: center;
  color: #ffff;
}
.componentInfo{
  height: 40px;
  line-height: 50px;
}
input{
  border: 0;
  outline: none;
}
</style>